<?php

class Log_user{

	private $kd_log;
	private $nip;
	private $waktu_log;
	
	function __construct(){}
	
	function setId($kd_log){
		$this->kd_log = $kd_log;
	}
	
	function setNip($nip){
		$this->nip = $nip;
	}
	
	function setWaktu_log($waktu_log){
		$this->waktu_log = $waktu_log;
	}
	
	function getId(){
		return $this->kd_log;
	}
	
	function getNip(){
		return $this->nip;
	}
	
	function getWaktu_log(){
		return $this->waktu_log;
	}
	

}

class Daftar_log_user{

	function __construct(){}
	
	function getAll(){
		$sql="
		select * from log_user order by kd_log desc
		";
		
		$list_log = array();
		
		$data = mysql_query($sql);
		if($data){
			while($row = mysql_fetch_assoc($data)){
			
				$log = new Log_user();
				$log->setId($row['kd_log']);
				$log->setNip($row['nip']);
				$log->setWaktu_log($row['waktu_log']);
				
				$list_log[] = $log;
			}
		}	
		return $list_log;
	
	}
	
	function add(Log_user $log_user){
	
		$sql="
		insert into 
		log_user  
		values (
		'',
		'".$log_user->getNip()."',
		'".$log_user->getWaktu_log()."'
		)";
		$query=mysql_query($sql);
		
	}
}
